package tuan.filter;

import org.w3c.dom.Node;

public class AllowdAttrFilter extends NodeFilter {
	String attrName;
	Object attrValue;

	public AllowdAttrFilter(String attrName, Object attrValue) throws Exception {
		if (attrName == null || attrValue == null) {
			throw new Exception("null arguments");
		}
		this.attrName = attrName;
		this.attrValue = attrValue;
	}

	@Override
	protected boolean isValid(Node node) {
		Object value = node.getUserData(attrName);
		if (attrValue.equals(value)) {
			return true;
		} else {
			return false;
		}
	}

}
